<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />  
<title>复制到剪贴板</title>
<script src="http://img3.job1001.com/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://img3.job1001.com/js/ZeroClipboard/jquery.zclip.min.js"></script>
</head>  
<body>  
    <input type="text" id="copy_value1"/>
    <input class="copy_btn" type="button" value="一键复制"/>
    <br/><br/>
    <input type="text" id="copy_value2"/>
    <input class="copy_btn2" type="button" value="一键复制" onclick="fun()"/>
    <br/><br/>
    <input type="text" id="copy_value3"/>
    <input class="copy_btn" type="button" value="一键复制"/>
    <script>
        $(document).ready(function(){
        	
            if ( window.clipboardData ) {
                $('.copy_btn').click(function() {
                    window.clipboardData.setData("Text", $(this).prev('input').val());
                    alert('复制成功！');
                });
            } else {
                $(".copy_btn").zclip({
                    path:'http://img3.job1001.com/js/ZeroClipboard/ZeroClipboard.swf',
                    copy:function(){return $(this).prev('input').val();},
                    afterCopy:function(){alert('复制成功！');}
                });
            }
        }); 
         
    </script>
</body>  
</html>
